Skip to content

DNM: psci-mfd driver for review#389

Open
quicAspratap wants to merge 3 commits intoqualcomm-linux:mainfrom
quicAspratap:psci
Open

DNM: psci-mfd driver for review#389
quicAspratap wants to merge 3 commits intoqualcomm-linux:mainfrom
quicAspratap:psci

Conversation

@quicAspratap
Copy link
Copy Markdown

Creating this pull request just for review of changes. This is DNM.

Shivendra Pratap added 3 commits March 27, 2026 19:56
PSCI supports different types of resets like COLD reset, ARCH WARM
reset, vendor-specific resets. Currently there is no common driver that
handles all supported psci resets at one place. Additionally, there is
no common mechanism to issue the supported psci resets from userspace.

Add a PSCI reboot mode driver and define two types of PSCI resets in the
driver as reboot-modes: predefined resets controlled by Linux
reboot_mode and customizable resets defined by SoC vendors in their
device tree under the psci:reboot-mode node.

Register the driver with the reboot-mode framework to interface these
resets to userspace. When userspace initiates a supported command, pass
the reset arguments to the PSCI driver to enable command-based reset.

This change allows userspace to issue supported PSCI reset commands
using the standard reboot system calls while enabling SoC vendors to
define their specific resets for PSCI.

Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Add a new PSCI MFD driver that binds to arm,psci-1.0 and registers
cpuidle-psci-domain as a child cell. Since cpuidle-psci-domain
now probes without its own of_node, use the parent PSCI of_node
to traverse the power domain.

Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Add a psci-reboot-mode cell to the psci-mfd driver and bind the
psci:reboot-mode node to it.

Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
@quicAspratap quicAspratap requested a review from brgl March 27, 2026 16:44

ret = devm_reboot_mode_register(&pdev->dev, reboot);
if (ret) {
dev_err_probe(&pdev->dev, ret, "devm_reboot_mode_register failed %d\n", ret);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return dev_err_probe()

{
struct reboot_mode_driver *reboot;
int ret;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add struct device *dev = &pdev->dev; for brevity

.name = "psci-reboot-mode",
},
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop this newline.


pr_err("DEBUG: PSCI write called");
pr_err("DEBUG: PSCI write called");
pr_err("DEBUG: PSCI write called");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these leftovers from development?

* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/

#include <linux/device/faux.h>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like leftover.

#include <linux/device/faux.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/of.h>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't seem to be using this nor err.h

select REBOOT_MODE
help
Say y here will enable PSCI reboot mode driver. This gets
the PSCI reboot mode arguments and passes them to psci
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some whitespace issue

Copy link
Copy Markdown

@brgl brgl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this commit to the back of the series so that it comes after the commit converting the existing driver to MFD

{
return platform_driver_register(&psci_mfd_driver);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop newline

Copy link
Copy Markdown

@brgl brgl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short and sweet, looks pretty good.

depends on ARM_PSCI_CPUIDLE
depends on PM_GENERIC_DOMAINS_OF
select DT_IDLE_GENPD
select MFD_PSCI
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this needs to depend on MFD_PSCI.

static int psci_cpuidle_domain_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct device_node *np = pdev->dev.parent->of_node;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should drop its of_device_id table in favor of being probed by the MFD parent exclusively.


static int psci_mfd_probe(struct platform_device *pdev)
{
return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, psci_cells,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been devm_mfd_add_devices() from the start.

if (ret)
goto out;

psci_mfd_bind_reboot_mode_node(pdev);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is racy, the sub-device could have already been probed at this time after devm_mfd_add_devices(). Maybe we need a compatible in the reboot-mode node after all. This would make it much easier with the of_compatible field of struct mfd_cell. Has there ever been a push back against it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants